﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;

namespace AISmartEventServer
{

    [ServiceContract]
    public interface AIEventManagerServerI
    {

        #region  添加人员
        /// <summary>
        ///  人员添加
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <param name="Person"></param>
        /// <param name="B64FacePics"></param>
        /// <returns></returns>
        [OperationContract]
        [WebInvoke(Method = "POST",UriTemplate = ProtocolStandard.Url_AddPerson, BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        string AddPerson(string ip, int port,string Person );
        #endregion

        #region 删除人员
        /// <summary>
        /// 删除人员
        /// </summary>
        /// <param name="personID"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(UriTemplate = ProtocolStandard.Url_DelPerson, BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
         string DeletePersonByID(string ip, int port, long personID);
        #endregion

        #region 获取人员人脸图片
        /// <summary>
        /// 获取人员人脸图片
        /// </summary>
        /// <param name="personID">人员ID</param>
        /// /// <param name="faceIndex">获取第几个图片 ,从0开始   -1为获取所有</param>
        /// <returns></returns>
        List<byte[]> GetPersonFace(string ip, int port, long personID, int faceIndex);

        #endregion

        #region 图片检测人脸
        /// <summary>
        /// 图片检测人脸
        /// </summary>
        /// <param name="picbytes"></param>
        /// <returns></returns>
         byte[] GetPersonDetectFace(string ip, int port, byte[] picbytes);

        #endregion
        
    }

    #region   协议
    /// <summary>
    ///  协议 
    /// </summary>
    public static class ProtocolStandard
    {
       
        //获取摄像机列表
        public const string Url_CamerasList   = 
         @"/faces/cameras?cameraName={cameraName}&address={address}&size={size}&page={page}&isAll={isAll}";

        //获取某个摄像机信息
        public const string Url_CameraModel 
            = 
       @"/faces/cameras/{cameraId}/info";

        //获取人脸库信息列表
        public const string Url_FacesResourcesList 
            = 
         @"/faces/facesResources?personType={personType}&size={size}&page={page}&isAll={isAll}";

        //获取人脸库信息列表
        public const string Url_FacesResourceModel 
            = 
        @"/faces/FacesResources/{faceId}/info";

        //获取人脸抓拍统计信息
        public const string Url_CaptrueTotal
            =
         @"/faces/recognition/statistics?startTime={startTime}&endTime={endTime}&cameraId={cameraId}&cycle={cycle}";
       
        //人员分类统计（抓拍信息）
        public const string Url_CaptrueParsonStatistics
            =
         @"/faces/recognition/CaptrueParsonStatistics?startTime={startTime}&endTime={endTime}&cameraId={cameraId}&cycle={cycle}";
        //获取人脸抓拍记录列表信息
        public const string Url_CaptrueRecordList 
            = 
        @"/faces/recognition/HistoryRecord?startTime={startTime}&endTime={endTime}&cameraId={cameraId}&personId={personId}&size={size}&page={page}";

        //获取人脸抓拍记录详细信息
        public const string Url_HistoryRecordDetail
            =
        @"/faces/recognition/HistoryRecordDetail?recordId={recordId}";
        

        //面部识别人口数据统计
        public const string Url_AlarmTotal 
          =
         @"/faces/alarm/statistics?startTime={startTime}&endTime={endTime}&cameraId={cameraId}&cycle={cycle}";
      
        //获取视频摘要列表
        public const string Url_AlarmRecordQuery 
            = 
         @"/faces/alarm/query?startTime={startTime}&endTime={endTime}&cameraId={cameraId}&personId={personId}&size={size}&page={page}";


        //添加人员
        public const string Url_AddPerson =
         @"/person/addperson";

        //删除人员
        public const string Url_DelPerson =
         @"/person/deleteperson?ip={ip}&port={port}&personID={personID}";         
    }
    #endregion

}
